what is causing the list index out of range error here